#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
inline int read()
{
    int x=0,f=1;
    char tmp;
    tmp=getchar();
    if(tmp<'0'||tmp>'9')
    {
        if(tmp=='-')
            f=-1;
    }
    else
    {
        x=tmp-'0';
    }
    tmp=getchar();
    while(tmp>='0'&&tmp<='9')
    {
        x*=10;
        x+=tmp-'0';
        tmp=getchar();
    }
    return f*x;
}
int n,m,r[100005],cnt[100005],ans,smaller;
bool flag;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=read();
    for(int i=0;i<n;i++)
    {
        r[i]=read();
        cnt[r[i]]++;
    }
    sort(r,r+n);
    int i=0,deaths=0;
    i+=cnt[r[0]];
    smaller=cnt[r[0]];
    while(i<n)
    {
        deaths=(cnt[r[i]]>smaller)?smaller:cnt[r[i]];
        ans+=deaths;
        smaller-=deaths;
        if(r[i]==r[n-1]) break;
        //---------------------------------------------------------
        smaller+=cnt[r[i]];
        i+=cnt[r[i]];
    }
    printf("%d",n-ans);
    fclose(stdin);
    fclose(stdout);
    return 0;
}
